﻿    <div class="fitem_auto padding_H" id="Root">
        <div v-show="msg" class="msgbox_alert">{{msg}}</div>
        <div v-show="active">
            <buttonlist :hook="hooks[0]" :set="sets[0]" class="wyjcontainer_H border_B padding_V"></buttonlist>
            <pagenation :hook="hooks[1]" :set="table" :api="Api" hasToolbar="yes">
                <template #toolbar="postData">
                    <input placeholder="请输入产品名称" v-model="postData.queryKeys.key" />
                </template>
                <template #td="models">
                    <td><a class="tooltip" @@click="Switch(3, models.model)">{{models.model.Production.Name}}<span class="tooltiptext">查看详情</span></a></td>
                    <td>{{models.model.Batch}}</td>
                    <td>{{models.model.Amount}}</td>
                    <td>{{models.model.Date}}</td>
                    <td>{{models.model.StockSpace.Name}}</td>
                    <td>
                        <a v-for="(btn,i) in icons" :key="i" :class="btn.class" @@click="btn.act(models.model)"><i :class="btn.icon"></i></a>
                    </td>
                </template>
            </pagenation>
        </div>
    </div>

@section foot {
    <script type="text/javascript">
        var app = new App({
            Api: 'InStock',
            table: {
                queryKeys: {
                    key: '',
                    Batch:'',
                    StockSpace:''
                },
                titles: ["产品名称", "产品批次", "入库数量", "入库时间", "入库库位", "操作"],
            },
            PageTitles: ['入库记录', '', '', ''],
            icons: [{
                icon:'fa fa-trash',
                act: (e, i) => {
                    app.DeleteById(e.Id, i)
                }
            }],
            labels: {
                Production: '入库产品',
                Batch: '产品批次',
                Amount: '入库数量',
                Date: '入库时间',
                StockSpace:'入库库位',
            },
        });
        app.BeforeSave = function (model) {
            model.Production = { Id: model.Production };
            model.StockSpace = { Id: model.StockSpace };
            console.log(model);
            return model;
        };
        app.on('btnAdd', (e) => {
            alert('请在手机端使用此功能');
        });
        Store.get(app.hooks[0]).btns[0].text='扫码入库';
    </script>
}